package cn.edu.scau.cmi.huxiantao.singleton;

import java.util.ArrayList;
import java.util.List;


public class Multipleton {
	private static List<Multipleton> list=new ArrayList<Multipleton>();
	
	private String name;
	
	private Multipleton(String name) {
		this.name=name;
	}
	
	public static void addInstance(String name){
		if(list.size()<10) {
			list.add(new Multipleton(name));
//			System.out.println("成功创建元帅："+name);
		}else {
//			System.out.println("元帅数量已经到达10个，无法继续创建");
		}
	}
	
	public static List<Multipleton> getAllInstances(){
		return list;
	}
	
	public void setName(String name) {
		this.name=name;
	}
	public String getName() {
		return name;
	}
}
